/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package socof_trab1;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Carlos Pinheiro
 */
public class ExecutorParser implements Runnable
{
    private ResizeableSemaphore rs;
    
    public ExecutorParser (ResizeableSemaphore sem) throws InterruptedException
    {
        this.rs = sem;
        this.rs.acquire();
    }
    
    @Override
    public void run()
    {
        try
        {           
            System.out.println("Parser: " + this.toString() + " started...");
            Thread.sleep(2000);
            System.out.println("Parser: " + this.toString() + " finished...");
            
            this.rs.release();
        }
        catch (InterruptedException ex)
        {
            Logger.getLogger(ExecutorParser.class.getName()).log(Level.SEVERE, null, ex);

        }
    }     
}
